package fun.flyee.android.pengshan.fgts;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import org.greenrobot.eventbus.EventBus;

import androidx.fragment.app.Fragment;
import butterknife.ButterKnife;

public abstract class BaseFragment extends Fragment implements PathEntry {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        EventBus.getDefault().register(this);
        return inflater.inflate(layoutId(), container, false);
    }

    @Override
    public void onViewCreated(View v, Bundle b) {
        ButterKnife.bind(this, v);
        initView();
        initData();
    }

    @Override
    public void onDestroy(){
        EventBus.getDefault().unregister(this);
        super.onDestroy();
    }

    abstract protected int layoutId();

    abstract protected void initView();

    abstract protected void initData();

}
